<template>
  <div>
      {{suiji}}
      <p>

          今天： {{today}}
      </p>
    <h3>about one</h3>
    <p>公共: {{ common }}</p>
    <input type="text" v-model="com" />
    <button @click="comChange">修改</button>
  </div>
</template>

<script>
import momentjs from 'moment';
import _ from 'lodash';
export default {
  name: "Aboutone",
  props: ["common"],
  data() {
    return {
      com: "",
      suiji:'',
      today:''
    };
  },
  methods: {
    comChange() {
      console.log(this.com);
      // this.$emit('comChange' , this.com)
      this.$EventBus.$emit("comChange", this.com);
    },
  },
  created() {
    const today = momentjs().format('YYYY-MM-DD');
    this.today= today;
    const random = _.random(100, 999);
    this.suiji = random;
    console.log("aboutone created");

    this.$EventBus.$on("comChange", (com) => {
      console.log(com);
      this.common = com;
    });
  },
  mounted() {
    console.log("abouone mounted");
  }
};
</script>

<style lang="scss" scoped>
</style>